//
//  BaseNaviController.m
//  onlineeducation_ios
//
//  Created by teammac3 on 2017/6/29.
//  Copyright © 2017年 zxj. All rights reserved.
//

#import "BaseNaviController.h"
#import "RentVieitor.h"
@interface BaseNaviController ()

@end
//Users/wonder/Desktop/rent/<built-in>:1:10: '/Users/wonder/Desktop/rent/RENTVISITOR/PrefixHeader.pch' file not found
@implementation BaseNaviController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor colorWithRed:214/255.0f green:214/255.0f blue:214/255.0f alpha:1];//BackGroundColor;
    //创建导航栏
    [self createNavigation];
}

#pragma mark - 导航栏
- (void)createNavigation{
    
    UIImageView *naviView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 64)];
    naviView.backgroundColor = [UIColor whiteColor];
    naviView.userInteractionEnabled = YES;
    _naviView = naviView;
    [self.view addSubview:naviView];
    
    
    //返回按钮
    UIButton *backBtn = [UIButton new];
    [backBtn setImage:[UIImage imageNamed:@"返回箭头"] forState:UIControlStateNormal];
//    UIButton *btn = [UIButton new];
    backBtn.imageView.contentMode = UIViewContentModeCenter;
    [backBtn addTarget:self action:@selector(backAction:) forControlEvents:UIControlEventTouchUpInside];
    [naviView addSubview:backBtn];
    [backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
//        make.bottom.mas_equalTo(naviView).mas_offset(-13);
        make.centerY.mas_equalTo(naviView).mas_offset(10);

        make.left.mas_equalTo(naviView).mas_offset(15*ScaleWidth);
//        make.width.mas_equalTo(15);
//        make.height.mas_equalTo(20);
        make.width.mas_equalTo(88*ScaleWidth);
        make.height.mas_equalTo(88*ScaleHeight);
    }];
    
    UILabel *titleL = [UILabel new];
    titleL.text = _titleStr;
//    NSLog(@"%@",_titleStr);
    titleL.textColor = [UIColor colorWithHexString:@"#333333"];
    titleL.font = [UIFont systemFontOfSize:19];
    titleL.textAlignment = NSTextAlignmentCenter;
    [naviView addSubview:titleL];
    [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(naviView).mas_offset(10);
        make.centerX.mas_equalTo(naviView);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(44);
    }];
    _titleL = titleL;
}
- (void)backAction:(UIButton *)btn{
    
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)setTitleStr:(NSString *)titleStr{
    _titleStr = titleStr;
}

@end
